package com.edu.common.utils;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;

public class RandomUtils {
	//随机生成密码池
	//A B C D E F G H J K L M N P Q R S T U V W X Y Z 2 3 4 5 6 7 8 9 
	private static Map<String,String[]> DOMS = new HashMap<String,String[]>();
	static{
		DOMS.put("0", new String[]{"a","u","w","8"});
		DOMS.put("1", new String[]{"b","t","z"});
		DOMS.put("2", new String[]{"v","s","y"});
		DOMS.put("3", new String[]{"d","r","z","9"});
		DOMS.put("4", new String[]{"e","q","2"});
		DOMS.put("5", new String[]{"f","p","3"});
		DOMS.put("6", new String[]{"g","n","4"});
		DOMS.put("7", new String[]{"h","m","5"});
		DOMS.put("8", new String[]{"j","l","6"});
		DOMS.put("9", new String[]{"k","v","7"});
	}
	
	public static String generate(){
		String result="";
		Random randomIndex = new Random();
		String code = String.valueOf(randomIndex.nextInt(999999));
		while(6-code.length() > 0){
			code = "0"+code;
		}
		char[] cr = code.toCharArray();
		Random random = new Random();
		for(char c : cr){
			String[] codeValue = DOMS.get(c+"");
			int randomValue = random.nextInt(codeValue.length);
			result += codeValue[randomValue];
		}
		return result;
	}
	
	public static void main(String[] args) {
		System.out.println(generate());
	} 

}
